set DESTDIR="."

If "%1" Neq "" (
	set DESTDIR=%1
)

del MemberInvite.zip
set ERRORS=0

echo Create directory
rem rd %DESTDIR% /S /Q > nul
mkdir %DESTDIR%\Temp

xcopy DotNetNuke\DesktopModules\MemberInvite\01.??.??.SqlDataProvider %DESTDIR%\Temp /C /I /Y < nul > nul
if not %ERRORLEVEL% == 0 set ERRORS=1
xcopy DotNetNuke\DesktopModules\MemberInvite\Uninstall.SqlDataProvider %DESTDIR%\Temp /C /I /Y < nul > nul
if not %ERRORLEVEL% == 0 set ERRORS=2
xcopy DotNetNuke\DesktopModules\MemberInvite\Settings.ascx %DESTDIR%\Temp /C /I /Y < nul > nul
if not %ERRORLEVEL% == 0 set ERRORS=3
xcopy DotNetNuke\DesktopModules\MemberInvite\UserSettings.ascx %DESTDIR%\Temp /C /I /Y < nul > nul
if not %ERRORLEVEL% == 0 set ERRORS=4
xcopy DotNetNuke\DesktopModules\MemberInvite\EditMemberInvite.ascx %DESTDIR%\Temp /C /I /Y < nul > nul
if not %ERRORLEVEL% == 0 set ERRORS=5
xcopy DotNetNuke\DesktopModules\MemberInvite\ViewMemberInvite.ascx %DESTDIR%\Temp /C /I /Y < nul > nul
if not %ERRORLEVEL% == 0 set ERRORS=6
xcopy DotNetNuke\DesktopModules\MemberInvite\StatusControl.ascx %DESTDIR%\Temp /C /I /Y < nul > nul
if not %ERRORLEVEL% == 0 set ERRORS=7
xcopy DotNetNuke\DesktopModules\MemberInvite\QuickInvite.ascx %DESTDIR%\Temp /C /I /Y < nul > nul
if not %ERRORLEVEL% == 0 set ERRORS=8
xcopy DotNetNuke\DesktopModules\MemberInvite\RegisterInvited.ascx %DESTDIR%\Temp /C /I /Y < nul > nul
if not %ERRORLEVEL% == 0 set ERRORS=9
xcopy DotNetNuke\DesktopModules\MemberInvite\MemberInvite.dnn %DESTDIR%\Temp /C /I /Y < nul > nul
if not %ERRORLEVEL% == 0 set ERRORS=10
xcopy DotNetNuke\DesktopModules\MemberInvite\App_LocalResources\*.resx %DESTDIR%\Temp /C /I /Y < nul > nul
if not %ERRORLEVEL% == 0 set ERRORS=11
xcopy DotNetNuke\bin\Jfc.DnnMarketingTools.MemberInvite.SQLDataProvider.dll %DESTDIR%\Temp /C /I /Y < nul > nul
if not %ERRORLEVEL% == 0 set ERRORS=12
xcopy DotNetNuke\bin\Jfc.DnnMarketingTools.MemberInvite.dll %DESTDIR%\Temp /C /I /Y < nul > nul
if not %ERRORLEVEL% == 0 set ERRORS=13

"c:\Program Files\7-Zip\7z.exe" a -tzip %DESTDIR%\MemberInvite.Zip %DESTDIR%\Temp\*.*
if not %ERRORLEVEL% == 0 set ERRORS=20

rmdir %DESTDIR%\Temp /s /q
if not %ERRORLEVEL% == 0 set ERRORS=21

if not %ERRORS% == 0 echo Errors occured

rem exit %ERRORS%
